<?php 
require('./roots.php');
require_once('./classes/rbac.php');
$lang=$_POST['lang'];
if(isset($lang)){

$_SESSION['lang']=$lang;

}

//$_SESSION['sess_login_username']='root';
//$_SESSION['roles']=array('rol'=>'1');


$role1=$_POST;

if(sizeof($role1)>1&& $_SESSION['sess_login_username']!=''){
    $role=$_POST;
    $roles=array();
    foreach($role as $rol){
        //var_dump($rol);
        if($rol!="Asignar")
            $roles[]=$rol;
        
    }
    $rbac=new rbac();
    $session=$rbac->Crear_session($_SESSION['sess_login_username'], $roles);
    $_SESSION['roles']=$session;
    //var_dump($_SESSION['roles']);

}
else{
    if(isset($_SESSION['roles']) && isset($_SESSION['sess_login_username'])){
    if( ($_SESSION['sess_login_username']!='') && ($_SESSION['roles']!='')){

        
    }
    else
        header('Location: index.php?valid=F');

}
    
}

include('languaje/'.$_SESSION['lang'].'/lang_'.$_SESSION['lang'].'_rbac.php');

include "header.php";


$action='rbac.php';

$msj = '';


?>
 <form method="post" action="<?php echo $action;?>" name="regform" ENCTYPE="multipart/form-data"> 


	<div id="page">
	<div id="page-bgtop">
	<div id="page-bgbtm">
		<div id="content">
			<div class="post">
			<div class="post-bgtop">
			<div class="post-bgbtm">
				<h2 class="title"><a href="#"><?php echo $LDAGL; ?></a></h2>
				 
				<div class="entry">
					<p>
																																				
						
								<?php echo $LDRolesMensaje; ?>
					</p>
				</div>
			</div>
			</div>
			</div>
			
		<div style="clear: both;">&nbsp;</div>
		</div>

		<div id="sidebar">
				<ul>
					<li>
						<h2><?php echo $LDCategorias; ?></h2>

						<?php

						include "MenuRbac.php";

						?>	
						<script type="text/javascript">

						cssdropdown.startchrome("chromemenu")

						</script>
				</li>
			</ul>
		</div>

		<div style="clear: both;">&nbsp;</div>
	</div>
	</div>
	</div>
</div>

</form>

<?php

include "footer.php";

?>
